define.template({
    type: 'View',
    commands: {
        'submit': {
            type: 'Submit',
            src: 'hello/submit',
            success: 'var responseData=$response.data;if(responseData){var msg="";for(var key in responseData){var arr=responseData[key];msg+=key+":"+arr.join(",")+"\\n";}$.alert(msg);}else{$.alert("暂无数据");}'
        }
    },
    node: {
        type: 'Vertical',
        nodes: [
            {
                type: 'ButtonBar', nodes: [
                    {type: 'SubmitButton', text: '提交', on: {click: 'this.cmd("submit");'}},
                    {text: '重置', on: {click: 'VM(this).resetForm();'}}
                ]
            },
            {
                type: 'Form',
                height: '*',
                hiddens: [
                    {name: 'hidden22', value: 'hidden22'},
                    {name: 'hidden33', value: 'hidden33'}
                ],
                pub: {colSpan: 4},
                nodes: [
                    {type: 'Text', name: 'text', label: {text: '显示名称'}, value: '123'},
                    {type: 'Text', name: 'textRequired', label: {text: '必填'}, validate: {required: true}, value: '222'},
                    {type: 'Text', name: 'textReadonly', label: {text: '只读'}, status: 'readonly', value: '123'},
                    {type: 'Text', name: 'textRequired', label: {text: '禁用'}, status: 'disabled', value: '456'},
                    {type: 'Text', name: 'noLabel', label: 'noLabel'},
                    {type: 'Text', name: 'textLabel', label: {text: 'textLabel', width: 200, suffix: ':'}},

                    {type: 'Hidden', name: 'hidden', value: 'hidden11'},

                    {type: 'Textarea', name: 'textarea', label: {text: 'textarea'}},

                    {type: 'Password', name: 'password', label: {text: 'password'}},

                    {type: 'Radio', name: 'radio', label: {text: 'radio'}, value: 'FZ', text: '福州'},

                    {
                        type: 'RadioGroup', label: {text: 'RadioGroup'}, pub: {name: 'RadioGroup1'},
                        nodes: [
                            {value: 'FZ', text: '福州', checked: true},
                            {value: 'XM', text: '厦门'},
                            {value: 'QZ', text: '泉州'}
                        ]
                    },

                    {
                        type: 'RadioGroup', label: {text: 'RadioGroup'}, pub: {name: 'RadioGroup2'}, dir: 'v',
                        nodes: [
                            {value: 'FZ', text: '福州'},
                            {value: 'XM', text: '厦门', checked: true},
                            {value: 'QZ', text: '泉州'}
                        ]
                    },

                    {
                        type: 'RadioGroup', label: {text: 'RadioGroup'}, pub: {name: 'RadioGroup3'},
                        nodes: [
                            {
                                value: 'FZ', text: '福州', target: {
                                    type: 'Text', name: 'radioFZ', label: 'radioFZ',
                                    validate: {required: true}
                                }
                            },
                            {
                                value: 'XM', text: '厦门', target: {
                                    type: 'Text', name: 'radioXM', label: 'radioXM',
                                    validate: {required: true}
                                }
                            },
                            {
                                value: 'QZ', text: '泉州', target: {
                                    type: 'Text', name: 'radioQZ', label: 'radioQZ',
                                    validate: {required: true}
                                }
                            }
                        ]
                    },

                    {type: 'CheckBox', name: 'checkBox', label: {text: 'checkBox'}, value: 'FZ', text: '福州'},

                    {
                        type: 'CheckBoxGroup', label: {text: 'CheckBoxGroup'}, pub: {name: 'CheckBoxGroup1'},
                        nodes: [
                            {value: 'FZ', text: '福州'},
                            {value: 'XM', text: '厦门'},
                            {value: 'QZ', text: '泉州'}
                        ]
                    },

                    {
                        type: 'CheckBoxGroup', label: {text: 'CheckBoxGroup'}, pub: {name: 'CheckBoxGroup2'}, dir: 'v',
                        nodes: [
                            {value: 'FZ', text: '福州'},
                            {value: 'XM', text: '厦门', checked: true},
                            {value: 'QZ', text: '泉州'}
                        ]
                    },

                    {
                        type: 'CheckBoxGroup', label: {text: 'CheckBoxGroup'}, pub: {name: 'CheckBoxGroup3'},
                        nodes: [
                            {
                                value: 'FZ', text: '福州', target: {
                                    type: 'Text', name: 'checkBoxFZ', label: 'checkBoxFZ',
                                    validate: {required: true}
                                }
                            },
                            {
                                value: 'XM', text: '厦门', target: {
                                    type: 'Text', name: 'checkBoxXM', label: 'checkBoxXM',
                                    validate: {required: true}
                                }
                            },
                            {
                                value: 'QZ', text: '泉州', target: {
                                    type: 'Text', name: 'checkBoxQZ', label: 'checkBoxQZ',
                                    validate: {required: true}
                                }
                            }
                        ]
                    },

                    {
                        type: 'Select', name: 'Select', label: {text: 'Select'}, value: 'FZ', nodes: [
                            {value: 'FZ', text: '福州'},
                            {value: 'XM', text: '厦门'},
                            {value: 'QZ', text: '泉州'}
                        ]
                    },

                    {
                        type: 'DropBox',
                        name: 'DropBox',
                        label: {text: 'DropBox'},
                        value: 'XM',
                        cancelable: true,
                        nodes: [
                            {value: 'FZ', text: '福州'},
                            {value: 'XM', text: '厦门'},
                            {value: 'QZ', text: '泉州'}
                        ]
                    },
                    {
                        type: 'DropBox',
                        name: 'DropBox2',
                        label: {text: 'DropBox2'},
                        value: 'XM',
                        multiple: true,
                        nodes: [
                            {value: 'FZ', text: '福州'},
                            {value: 'XM', text: '厦门'},
                            {value: 'QZ', text: '泉州'}
                        ]
                    },

                    {
                        type: 'ImgBox',
                        name: 'ImgBox',
                        label: {text: 'ImgBox'},
                        value: 'del',
                        nodes: [
                            {value: 'edit', text: '编辑', icon: '.i-operation-edit'},
                            {value: 'del', text: '删除', icon: '.i-operation-del'},
                            {value: 'more', text: '更多', icon: '.i-operation-more'}
                        ]
                    },

                    {
                        type: 'ComboBox',
                        name: 'ComboBox',
                        label: {text: 'ComboBox'},
                        bind: {
                            field: {
                                value: 'value',
                                text: 'text'
                            }
                        },
                        multiple: true,
                        suggest: {
                            type: 'Dialog',
                            node: {
                                type: 'View',
                                node: {
                                    type: 'Vertical',
                                    nodes: [
                                        {
                                            type: 'Table',
                                            id: 'table',
                                            columns: [
                                                {
                                                    field: 'text', highlight: true
                                                }
                                            ],
                                            tBody: {
                                                nodes: [
                                                    {value: '350101000000', text: '市辖区'},
                                                    {value: '350102000000', text: '鼓楼区'},
                                                    {value: '350103000000', text: '台江区'},
                                                    {value: '350104000000', text: '仓山区'},
                                                    {value: '350105000000', text: '马尾区'},
                                                    {value: '350111000000', text: '晋安区'},
                                                    {value: '350112000000', text: '长乐区'},
                                                    {value: '350121000000', text: '闽侯县'},
                                                    {value: '350122000000', text: '连江县'},
                                                    {value: '350123000000', text: '罗源县'},
                                                    {value: '350124000000', text: '闽清县'},
                                                    {value: '350125000000', text: '永泰县'},
                                                    {value: '350128000000', text: '平潭县'},
                                                    {value: '350181000000', text: '福清市'}
                                                ]
                                            }
                                        },
                                        {
                                            type: 'PageBar',
                                            face: 'mini',
                                            align: 'right',
                                            pageSize: 5,
                                            buttonCount: 5,
                                            target: 'table'
                                        }
                                    ]
                                }
                            }
                        },
                        picker: {
                            type: 'Dialog',
                            cls: 'dlg-picker',
                            node: {
                                type: 'View',
                                commands: {
                                    'yes': {
                                        type: 'JS',
                                        text: '$.dialog(this).commander.val(VM(this).find("table").getFocus().data("value"));$.close(this);'
                                    }
                                },
                                node: {
                                    type: 'Vertical',
                                    nodes: [
                                        {
                                            type: 'Table',
                                            id: 'table',
                                            height: '*',
                                            columns: [
                                                {
                                                    field: 'text', highlight: true
                                                }
                                            ],
                                            pub: {
                                                on: {dblClick: '$.dialog(this).commander.val(this.data("value"));$.close(this);'}
                                            },
                                            tBody: {
                                                nodes: [
                                                    {value: '350101000000', text: '市辖区'},
                                                    {value: '350102000000', text: '鼓楼区'},
                                                    {value: '350103000000', text: '台江区'},
                                                    {value: '350104000000', text: '仓山区'},
                                                    {value: '350105000000', text: '马尾区'},
                                                    {value: '350111000000', text: '晋安区'},
                                                    {value: '350112000000', text: '长乐区'},
                                                    {value: '350121000000', text: '闽侯县'},
                                                    {value: '350122000000', text: '连江县'},
                                                    {value: '350123000000', text: '罗源县'},
                                                    {value: '350124000000', text: '闽清县'},
                                                    {value: '350125000000', text: '永泰县'},
                                                    {value: '350128000000', text: '平潭县'},
                                                    {value: '350181000000', text: '福清市'}
                                                ]
                                            }
                                        },
                                        {
                                            type: 'PageBar',
                                            align: 'right',
                                            pageSize: 5,
                                            buttonCount: 5,
                                            target: 'table'
                                        }
                                    ]
                                }
                            }
                        }
                    },

                    {
                        type: 'LinkBox',
                        name: 'LinkBox',
                        label: {text: 'LinkBox'},
                        bind: {
                            field: {
                                value: 'value',
                                text: 'text'
                            }
                        },
                        multiple: true,
                        suggest: {
                            type: 'Dialog',
                            node: {
                                type: 'View',
                                node: {
                                    type: 'Vertical',
                                    nodes: [
                                        {
                                            type: 'Table',
                                            id: 'table',
                                            columns: [
                                                {
                                                    field: 'text', highlight: true
                                                }
                                            ],
                                            tBody: {
                                                nodes: [
                                                    {value: '350101000000', text: '市辖区'},
                                                    {value: '350102000000', text: '鼓楼区'},
                                                    {value: '350103000000', text: '台江区'},
                                                    {value: '350104000000', text: '仓山区'},
                                                    {value: '350105000000', text: '马尾区'},
                                                    {value: '350111000000', text: '晋安区'},
                                                    {value: '350112000000', text: '长乐区'},
                                                    {value: '350121000000', text: '闽侯县'},
                                                    {value: '350122000000', text: '连江县'},
                                                    {value: '350123000000', text: '罗源县'},
                                                    {value: '350124000000', text: '闽清县'},
                                                    {value: '350125000000', text: '永泰县'},
                                                    {value: '350128000000', text: '平潭县'},
                                                    {value: '350181000000', text: '福清市'}
                                                ]
                                            }
                                        },
                                        {
                                            type: 'PageBar',
                                            face: 'mini',
                                            align: 'right',
                                            pageSize: 5,
                                            buttonCount: 5,
                                            target: 'table'
                                        }
                                    ]
                                }
                            }
                        },
                        picker: {
                            type: 'Dialog',
                            cls: 'dlg-picker',
                            node: {
                                type: 'View',
                                commands: {
                                    'yes': {
                                        type: 'JS',
                                        text: '$.dialog(this).commander.val(VM(this).find("table").getFocus().data("value"));$.close(this);'
                                    }
                                },
                                node: {
                                    type: 'Vertical',
                                    nodes: [
                                        {
                                            type: 'Table',
                                            id: 'table',
                                            height: '*',
                                            columns: [
                                                {
                                                    field: 'text', highlight: true
                                                }
                                            ],
                                            pub: {
                                                on: {dblClick: '$.dialog(this).commander.val(this.data("value"));$.close(this);'}
                                            },
                                            tBody: {
                                                nodes: [
                                                    {value: '350101000000', text: '市辖区'},
                                                    {value: '350102000000', text: '鼓楼区'},
                                                    {value: '350103000000', text: '台江区'},
                                                    {value: '350104000000', text: '仓山区'},
                                                    {value: '350105000000', text: '马尾区'},
                                                    {value: '350111000000', text: '晋安区'},
                                                    {value: '350112000000', text: '长乐区'},
                                                    {value: '350121000000', text: '闽侯县'},
                                                    {value: '350122000000', text: '连江县'},
                                                    {value: '350123000000', text: '罗源县'},
                                                    {value: '350124000000', text: '闽清县'},
                                                    {value: '350125000000', text: '永泰县'},
                                                    {value: '350128000000', text: '平潭县'},
                                                    {value: '350181000000', text: '福清市'}
                                                ]
                                            }
                                        },
                                        {
                                            type: 'PageBar',
                                            align: 'right',
                                            pageSize: 5,
                                            buttonCount: 5,
                                            target: 'table'
                                        }
                                    ]
                                }
                            }
                        }
                    },

                    {
                        type: 'OnlineBox',
                        name: 'OnlineBox',
                        label: {text: 'OnlineBox'},
                        bind: {
                            field: {
                                value: 'text',
                                text: 'text'
                            }
                        },
                        suggest: {
                            type: 'Dialog',
                            node: {
                                type: 'View',
                                node: {
                                    type: 'Vertical',
                                    nodes: [
                                        {
                                            type: 'Table',
                                            id: 'table',
                                            columns: [
                                                {
                                                    field: 'text', highlight: true
                                                }
                                            ],
                                            tBody: {
                                                nodes: [
                                                    {value: '350101000000', text: '市辖区'},
                                                    {value: '350102000000', text: '鼓楼区'},
                                                    {value: '350103000000', text: '台江区'},
                                                    {value: '350104000000', text: '仓山区'},
                                                    {value: '350105000000', text: '马尾区'},
                                                    {value: '350111000000', text: '晋安区'},
                                                    {value: '350112000000', text: '长乐区'},
                                                    {value: '350121000000', text: '闽侯县'},
                                                    {value: '350122000000', text: '连江县'},
                                                    {value: '350123000000', text: '罗源县'},
                                                    {value: '350124000000', text: '闽清县'},
                                                    {value: '350125000000', text: '永泰县'},
                                                    {value: '350128000000', text: '平潭县'},
                                                    {value: '350181000000', text: '福清市'}
                                                ]
                                            }
                                        },
                                        {
                                            type: 'PageBar',
                                            face: 'mini',
                                            align: 'right',
                                            pageSize: 5,
                                            buttonCount: 5,
                                            target: 'table'
                                        }
                                    ]
                                }
                            }
                        }
                    },

                    {
                        type: 'PickBox',
                        name: 'PickBox',
                        label: {text: 'PickBox'},
                        bind: {
                            field: {
                                value: 'value',
                                text: 'text'
                            }
                        },
                        picker: {
                            type: 'Dialog',
                            cls: 'dlg-picker',
                            node: {
                                type: 'View',
                                commands: {
                                    'yes': {
                                        type: 'JS',
                                        text: '$.dialog(this).commander.val(VM(this).find("table").getFocus().data("value"),VM(this).find("table").getFocus().data("text"));$.close(this);'
                                    }
                                },
                                node: {
                                    type: 'Vertical',
                                    nodes: [
                                        {
                                            type: 'Table',
                                            id: 'table',
                                            height: '*',
                                            columns: [
                                                {
                                                    field: 'text', highlight: true
                                                }
                                            ],
                                            pub: {
                                                on: {dblClick: 'this.cmd("yes");'}
                                            },
                                            tBody: {
                                                nodes: [
                                                    {value: '350101000000', text: '市辖区'},
                                                    {value: '350102000000', text: '鼓楼区'},
                                                    {value: '350103000000', text: '台江区'},
                                                    {value: '350104000000', text: '仓山区'},
                                                    {value: '350105000000', text: '马尾区'},
                                                    {value: '350111000000', text: '晋安区'},
                                                    {value: '350112000000', text: '长乐区'},
                                                    {value: '350121000000', text: '闽侯县'},
                                                    {value: '350122000000', text: '连江县'},
                                                    {value: '350123000000', text: '罗源县'},
                                                    {value: '350124000000', text: '闽清县'},
                                                    {value: '350125000000', text: '永泰县'},
                                                    {value: '350128000000', text: '平潭县'},
                                                    {value: '350181000000', text: '福清市'}
                                                ]
                                            }
                                        },
                                        {
                                            type: 'PageBar',
                                            align: 'right',
                                            pageSize: 5,
                                            buttonCount: 5,
                                            target: 'table'
                                        }
                                    ]
                                }
                            }
                        }
                    },

                    {
                        type: 'DatePicker',
                        name: 'DatePicker',
                        label: {text: 'DatePicker'}
                    },
                    {
                        type: 'DatePicker',
                        name: 'DatePicker2',
                        label: {text: 'DatePicker2'},
                        format: 'yyyy-mm-dd hh:ii',
                        width: '*'
                    },
                    {
                        type: 'DatePicker',
                        name: 'DatePicker3',
                        label: {text: 'DatePicker3'},
                        format: 'yyyy-mm'
                    },
                    {
                        type: 'DatePicker',
                        name: 'DatePicker4',
                        label: {text: 'DatePicker4'},
                        format: 'yyyy'
                    },

                    {
                        type: 'Spinner',
                        name: 'Spinner',
                        label: {text: 'Spinner'}
                    },
                    {
                        type: 'Spinner',
                        name: 'Spinner2',
                        label: {text: 'Spinner2'},
                        decimal: 2,
                        step: 5
                    },
                    {
                        type: 'Spinner',
                        name: 'Spinner3',
                        label: {text: 'Spinner3'},
                        width: '*',
                        format: {},
                        noButton: true
                    },
                    {
                        type: 'Spinner',
                        name: 'Spinner4',
                        label: {text: 'Spinner4'},
                        width: '*',
                        format: {length: 4, separator: ' ', rightward: true},
                        noButton: true
                    },

                    {
                        type: 'Range',
                        label: {text: 'DatePickerRange'},
                        begin: {
                            type: 'DatePicker',
                            name: 'DatePickerBegin',
                            label: '开始时间'
                        },
                        end: {
                            type: 'DatePicker',
                            name: 'DatePickerEnd',
                            label: '结束时间'
                        }
                    },

                    {
                        type: 'Range',
                        label: {text: 'SpinnerRange'},
                        begin: {
                            type: 'Spinner',
                            name: 'SpinnerBegin',
                            label: '开始数值'
                        },
                        end: {
                            type: 'Spinner',
                            name: 'SpinnerEnd',
                            label: '结束数值'
                        },
                        to: '到'
                    },

                    {
                        type: 'Switch',
                        name: 'Switch',
                        label: {text: 'Switch'},
                        value: '1',
                        checkedText: '开',
                        uncheckedText: '关'
                    },

                    {
                        type: 'Rate',
                        name: 'Rate',
                        label: {text: 'Rate'},
                        value: 7
                    },

                    {
                        type: 'Slider',
                        name: 'Slider',
                        label: {text: 'Slider'},
                        value: 7
                    },
                    {
                        type: 'Jigsaw',
                        name: 'Jigsaw',
                        label: {text: 'Jigsaw'}
                    },
                    {
                        type: 'FormGroup',
                        label: {text: 'FormGroup'},
                        nodes: [
                            {type: 'Radio', name: 'gender', value: '1', text: '男', checked: true},
                            {type: 'Radio', name: 'gender', value: '2', text: '女'}
                        ]
                    },

                    {
                        type: 'FormLabel',
                        label: {text: 'FormLabel'},
                        text: '这是FormLabel'
                    },
                    {
                        type: 'FormGroup',
                        label: {text: 'FormGroupLabel'},
                        nodes: [
                            {type: 'Html', text: '这是FormGroupLabel'}
                        ]
                    },
                    {
                        type: 'FileUpload',
                        name: 'FileUpload',
                        label: {text: 'FileUpload'},
                    },
                    {
                        type: 'ImageUpload',
                        name: 'ImageUpload',
                        label: {text: 'ImageUpload'},
                    },

                ]
            }
        ]
    }
});

